package com.tcm.item.service.category;

import com.tcm.item.domain.dto.CategoryDTO;
import com.tcm.item.domain.vo.DrugsCategoryVO;

import java.util.List;

public interface CategoryService {
    /**
     * 获得一级子分类
     * @param parentId 父id
     * @return
     * @throws Exception
     */
    List<DrugsCategoryVO> listSubCategory(Long parentId) throws Exception;

    /**
     * 查询分类数据
     * @param id
     * @return
     */
    DrugsCategoryVO findCategoryById(Long id);

    /**
     * 查询所有分类
     * @return
     */
    List<DrugsCategoryVO> listAllCategory() throws Exception;

    /**
     * 转换为树形结构
     * @return
     * @throws Exception
     */
    List<DrugsCategoryVO> listToTree() throws Exception;


    /**
     * 递归查询子类
     * @param parentId 父类id
     * @param recursive
     * @return
     * @throws Exception
     */
    List<DrugsCategoryVO> listSubCategory(Long parentId, boolean recursive) throws Exception;

    /**
     * 加载所有父分类
     * @param categoryId
     * @return
     * @throws Exception
     */
    List<DrugsCategoryVO> loadParents(Long categoryId) throws Exception;

    /**
     * 获取当前类别的所有父类别ID
     * @param categoryId
     * @return
     * @throws Exception
     */
    List<Long> listParentIds(Long categoryId) throws Exception;

    /**
     * 获得当前类别所有子类别ID
     * @param categoryId
     * @return
     * @throws Exception
     */
    List<Long> listChildIds(Long categoryId) throws Exception;

    /**
     * 验证分类有效性
     * @param categoryId
     * @return
     */
    DrugsCategoryVO validCategory(Long categoryId);

    /**
     * 创建分类
     * @param categoryDto
     * @return
     */
    int createCategory(CategoryDTO categoryDto);

    /**
     * 更新分类
     * @param itemCategoryDto
     * @return
     */
    int updateCategory(CategoryDTO itemCategoryDto);

    /**
     * 删除分类
     * @param categoryId
     * @return
     */
    int deleteCategory(Long categoryId);

}
